Writing in the mks4agb.ini File


In order to create sound objects correctly, the mks4agb.ini file must be correctly written. Using any general-use text editor, set up the parameters in the mks4agb.ini  file. 

The mks4agb.ini file contains comments (the portions following the semicolons ";") so be sure to read those also.


INDEX   Writing in the mks4agb.ini File
  
  (1)   rebuild =           Rebuild Switch
  (2)   aif_dir =           Waveform Data Input Directory
  (3)   mid_dir =           Song Data Input Directory
  (4)   src_dir =           Source File Directory
  (5)   out_dir =           Output Directory
  (6)   agb_lib =           AGB System Library File Directory
  (7)   cmd_path =          GCC Execution Path
  (8)   mode_i =            Initial Setup Values for the Sound Modes
  (9)   vgroup =            Begin Tone Color Group Setup
 (10)  p??? =               Tone Color Setup
       *Tone Color Type
                     A or F  (Direct Sound) Setup
                     P or Q  (CGB Compatible Sound) Setup
                     R       (Rhythm Set) Setup
                     S       (Key Split Tone Color) Setup
 (11)  t??? =               Key Split Table Setup
 (12)  w??? =               Sound 3 Waveform Setup
 (13)  mp??? =              Music Player Setup 
 (14)  s??? =               Song Setup
 (15)  pbymidi =            MIDI Input Performance Setup
 (16)  memacc_s =           Memory Access Area Size
 (17)  max_line =           Maximum Lines for Processing Time of m4aSoundMain()
 (18)  only_dma1 =          DMA Limit Switch
 (19)  sys_rom =            System ROM Use Switch
				

		

(1) rebuild = Rebuild Switch

Once a sound object has been configured, this system will reconfigure only the data that is subsequently updated. It does not reconfigure sections that have not been modified. 
  (This is generally known as the "Make function.")
Set this to  "0" for normal use. However, in the event that it becomes necessary to reconfigure everything for some reason, set this to "1." 

Return to Top


		

(2) aif_dir = Waveform Data Input Directory

This specifies the directory where the waveform data file(s)  {wavename}.aif are to be placed. 
List the absolute path starting with the drive name or else the relative path using the working directory as the reference. If a non-existent drive is specified, an error will result. 

Return to Top


		

(3) mid_dir = Song Data Input Directory

This specifies the directory where the song data file(s)  {songname}.mid are to be placed. 
List the absolute path starting with the drive name or else the relative path using the working directory as the reference.  If a non-existent drive is specified, an error will result. 

Return to Top


		

(4) src_dir = Source File Directory

This specifies the directory where .s files and other files are output. 
It is possible to create more detailed data by editing the song data files  {songname}.s in this directory.  List the absolute or relative path here. 
If a non-existent directory is specified, there will be a query about making a new directory immediately after this is run. 

Return to Top


		

(5) out_dir = Output Directory

This specifies the directory where .o files  and other files are output.
Normally, all of the files created in this directory are passed over to the main program side. 
List the absolute or relative path here.
If a non-existent directory is specified, there will be a query about making a new directory immediately after this is run.

Return to Top


		

(6) agb_lib = AGB System Library File Directory

List the library file directory created with the Game Boy Advance Developer Tool Kit. Normally, this is the directory specified using the first -L option of the LDFLAGS in the "Makefile."

Return to Top


		

(7) cmd_path = GCC Execution Path

This writes the run path of the GCC or other compilers. Under normal conditions, please list the directory specified in the final path of the agb_c2s.bat file. 
If there are semicolons ";" anything following them will be commented out, so in such cases, start a new line with a carriage return and list it again using cmd_path = .

Return to Top


		

(8) mode_i = Initial Setup Values for the Sound Modes

(Syntax)
  mode_i = max_ch, m_vol, freq, DA_bit

  max_ch : 1~12                 Number of Simultaneously-Produced Direct Sounds
     m_vol : 1~15                 Direct Sound Master Volume
         freq : 5734-42048    Direct Sound Playback Frequency
    DA_bit : 9-6                   Final Output D/A Conversion Bit Count

(Syntax Example)
  mode_i = 8, 13, 21024, 8


The sound functions set up the initial values of the sound modes when started up using m4aSoundInit().

Return to Top

1 ~ 12. This specifies the number of simultaneously-produced direct sounds. For more information, refer to the separate section, Number of Simultaneously-Produced Direct Sounds. (Default Value: 8)

            (8) mode_i

1 ~ 15. This specifies the master volume of the direct sounds.
If the sounds produced overlap and the output levels are driven too hard causing a lot of distortion, reduce this value and lower the overall volume of the direct sounds. (Default Value: 15)

            (8) mode_i

5734 ~ 42048.  This specifies the direct sound playback frequencies. For more information, please refer to the separate section Direct Sound Playback Frequencies. Note that when these figures are not rated levels, the nearest rated level will be selected automatically by internal logic.
   (Default Value: 13379)

            (8) mode_i

9 ~ 6. This specifies the final output DA conversion bit count. For more information, please refer to the separate section Sound Output DA Conversion Bit Count (Frequency).
   (Default Value: 8)

            (8) mode_i


		

(9) vgroup = Tone Color Group Number Setup

The Tone Color Setup (p???)  written after these settings are registered as "Tone Color Groups" having the number specified here. (Initial Value of "0.")
  The tone color settings can be set to start at "0" for each Tone Color Group. 

(Example)
  vgroup = 0
  p000 = ..... (Tone Color Setup for Tone Color Group 0,Tone Color Number 0.)
          ~
  p015 = ..... (Tone Color Setup for Tone Color Group 0, Tone Color Number 15.)
  vgroup = 1 
  p000 = ..... (Tone Color Setup for Tone Color Group 1, Tone Color Number 0.) 
           ~

Also, for each unit of  Song Data, one Tone Color Group will be specified for use. 
For more information, please refer to the Song Setup

Return to Top


		

(10) p??? = Tone Color Setup

These are the settings corresponding to the MIDI Program Change Numbers. The tone colors having the numbers specified as Program Change Numbers in the Song Data file will be output. (In the .sFile it is the number next to the "VOICE" label.)

The question marks "???" in "p???" are 3-digit, single-byte tone color numbers and can range from "000 ~ 127." These numbers do not have to be in sequence, but the same number cannot be used more than once. If the Tone Color Groups are different, they may be used more than once.)

After the "p??? =" comes the tone color type. Subsequent parameters are separated with commas, but be aware that what you write depends on the tone color type. 

Tone Color Types

  A Direct Sound
  F Direct Sound(Fixed Scale)
  P CGB Compatible Sound (Scale Priority)
  Q CGB Compatible Sound (Sound Quality Priority)
  R Rhythm Set
  S Key Split Tone Color

Return to Top


		
A or F (Direct Sound) Setup

(Syntax)
  p??? = type, wave, attack, decay, sustain, release, comp, rhykey, rhypan

       wave : .AIF file                       AIFF File Name
     attack : 0 ~ 99                          Attack Speed (99= Fastest)
     decay : 0 ~ 99                          Decay Speed (99= Fastest)
  sustain : 0 ~ 99                           Sustain Level (99= Maximum)
  release : 0 ~ 99                           Release Speed (99= Maximum)
     rhykey : 0 ~ 127 (C-2 ~ G8)    Scale Produced When Rhythm Set Used
    rhypan : off, -64 ~ 63               Panpot When Rhythm Set Used
      comp : 0.1 ~ 1                         Sampling Sound Compression Rate

(Syntax)
  p000 = A, sample.aif, 96, 60, 60, 90, 60, off, 1

This type of tone color outputs a sampled waveform using direct sound. 
Because of higher processing speeds, the scale calculations are omitted at the time of output, particularly Type F. 

Return to Top

This writes the waveform data file name. If the extension is .aif, then the extension does not have to be written out. The same file name may be used any number of times, but the value of the Compression Rate described below will be the value that was set when that file was first written. 
Note that if this file name is 64 letters or less, then it may contain a relative path conforming to aif_dir.

            A or F

0 ~ 99 The larger the number, the faster the start up.(Default Value: 99.) 

            A or F

0  ~ 99. The larger the number, the faster the attenuation. (Default Value: 99.)

             A or F

0 ~ 99. The larger the number, the greater the level.(Default Value: 99.)

            A or F

0  ~ 99. The larger the number, the faster the attenuation. (Default Value: 99.)

            A or F

0 ~ 127 (C - 2 ~ G8) When the current Tone Color Group  is used as the Rhythm Set, the scale that this tone color is produced with. (Default Value: 60.)

            A or F

-64 ~ 63 or off. When the current Tone Color Group  is used as the  Rhythm Set, the panpot of this tone color. When "off" it is produced with that track's panpot.(Default Value: off.)

            A or F

0.1 ~ 1. Compresses waveform data. However, compression (rate down) using waveform editing software yields better sound quality.(Default Value: 1.)

            A or F
The above syntax examples can be written in abbreviated form as follows. 

(Example of Abbreviated Syntax)
  p000 = A, sample, 96, 60, 60, 90, 60

            A or F

		
P or Q (CGB Compatible Sound) Setup

  p??? = type, wave, attack, decay, sustain, release, rhykey, rhypan, length, sweep

      wave : sc?????                            Waveform Name
     attack : 0 ~ 99                                Attack Speed (99= Fastest)
     decay : 0 ~ 99                                Decay Speed (99= Fastest)
  sustain : 0 ~ 99                                 Sustain Level (99= Maximum)
  release : 0 ~ 99                                 Release Speed (99= Fastest)
     rhykey : 0 ~ 127 (C-2 ~ G8)          Scale Produced when Rhythm Set Used
    rhypan : off, -64 ~ 63                     Panpot when Rhythm Set Used
     length : 0 ~ 63 (~ 255(sc3))          Length Data (0= Continuous)
    sweep : 0 ~ 7F (Hexadecimal)      Sweep (only for sc1)(0= Off)

    *When the "sweep" is on, the "rhypan" settings are "off."
(Syntax Example)
  p000 = P, sc1dt50, 99, 80, 85, 64, 60, off, 0, 0 ; (Sound 1)
  p001 = P, sinewave, 99, 80, 85, 64, 60, off, 0, 0 ; (Sound 3)

This type is the tone color that outputs timbre using CGB compatible sound. 
In order to produce a clear tone color, particularly with Type Q, some of the lower bits on the scale will be cleared when output, so the higher the sound, the greater the scale error. 

Return to Top

Waveform Name (wave : sc1dt50, sinewave)

sc1dt??: Sound 1 Duty (?? = 12,25,50,75 (%))
sc2dt??: Sound 2        "
sc3w???: Sound 3 Waveform (??? = 000~031)
  *Label names can only be used for Sound 3 (Waveform Setup described below.)
  *Up to 32 waveforms can be registered for use with Sound 3. 
sc4st??: Number of Sound 4 Stages (?? = 15 or 07)
(No Default)

            P or Q
Attack Speed (attack : 99)

0 ~ 99 (However, this is actually 7 stages due to hardware limitations.)
The larger the value, the faster the start up. (Default Value: 99.)

            P or Q
Decay Speed (decay : 80)

0 ~ 99 (However, this is actually 7 stages due to hardware limitations.)
The larger the value, the faster the start up.  (Default Value: 99.)

            P or Q
Sustain Level (sustain : 85)

0 ~ 99 (However, this is actually 15 stages due to hardware limitations.)
The larger the value, the greater the level.  (Default Value: 99.)

            P or Q
Release Speed (release : 64)

0 ~ 99 (However, this is actually 7 stages due to hardware limitations.)
The larger the value, the faster the attenuation.  (Default Value: 99.)

            P or Q
Scale Produced when the Rhythm Set is Used  (rhykey : 60)

00 ~ 127 (C - 2 ~ G8). The scale that this tone color is produced with when the current tone color groups are used as the rhythm set.  (Default Value: 60.)

            P or Q
Panpot when the Rhythm Set is Used  (rhypan : off)

-64 ~ 63 or off. The panpot that this tone color will be produced with when the current tone color groups are used as the rhythmset.  When "off," it will be produced with the panpot for that particular track.  (Default Value: off.)

            P or Q
Length Data  (length : 0)

0 ~ 63 (For Sound 3, 0 ~ 255). Determines how many 256ths of a second a note will be. When "0," it does not function. (Default Value: 0.)

            P or Q

00 ~ 7F (Hexadecimal). This is the value written into the hardware register "0x04000060" and is only valid for Sound 1. When "0," it does not function. 
When this value is set to anything other than "0," the panpot in the rhythm set will stop functioning.(Default Value: 0.)

            P or Q
When the above examples are abbreviated, they can be written as follows.

(Example of Abbreviated Syntax)
  p000 = P, sc1dt50, 99, 80, 85, 64
  p001 = P,sinewave, 99, 80, 85, 64

            P or Q

		
R (Rhythm Set) Setup

(Syntax)
  p??? = type, vgroup, btmkey

  vgroup : 0 ~ 999                          The vgroups to be used as the rhythm set. 
  btmkey : 0 ~ 127 (C-2 ~ G8)        Lower MIDI Key Number Limit

(Syntax Example)
  p127 = R, 1, c1

When this type of tone color is selected as a MIDI program change, separate tone colors will be allocated for the subsequent individual tracks, making it a useful mode for Rhythm and other tracks. 

Return to Top

0 ~ 999. There will be a one to one correspondence between the tone colors selected in the vgroup and their corresponding tracks.
Allocations will be made in order. For example, C1 = p036, C#1 = p037, D1 = P038...
(Default Value: 0.)

            R

0 ~ 127 (C - 2 ~ G8). Here, the MIDI Key Number Setup will correspond to p000. 
For example, if C1 was specified here, the relationship between the scale and the tone color would take the following order: C1 = p000, C#1 = p001, D1 = p002.... (Default Value: 0 (C-2).)

            R


		
s (Key Split Tone Color) Setup

(Syntax)
  p??? = type, table, vgroup, btmkey

      table : 0 ~ 31                           Key Split Table Number (See Below)
   vgroup : 0 ~ 999                        vgroup used as Key Split Tone Color 
  btmkey : 0 ~ 127 (C-2 ~ G8)       Lower MIDI Key Number Limit

(Syntax Example)
  p024 = S, 0, 2, c1

When this type of tone color is selected with the MIDI Program Change, subsequent tracks can be allocated to any scale and any tone color. This is a useful mode for when the entire range of sound cannot be covered by a single type of tone color, like live piano. 

Return to Top

0 ~ 31.  This sets the number of the Key Split Table described below. Here, there is a one to one correspondence between each of the elements within the selected table and the scale for that track. 
For example, allocations can be made in order: C1 = t??? [36], C#1 = t??? [37], D1 = t??? [38]...(Default Value: 0.)

            S

0 ~ 999. The scale of a track is first converted to a tone color number using the Key Split Table and, ultimately, a tone color in the vgroup selected here will be selected. 
(Default Value: 0.)

            S

0 ~ 127 (C - 2 ~ G8) MIDI Key Numbers specified here correspond to the initial elements in the Key Split Table. For example, if C1 were specified here, the relationship between the scale and the tone color would take the order C1 = T??? [0], C#1 = t??? [1], D1 = t??? [2]...  (Default Value: 0 (C-2).

            S


		

(11) t??? = Key Split Table Setup

(Syntax)
  t??? = xxx, xxx, xxx, xxx, ...

  t??? : t000 ~ t031                           Key Split Table Number
     xxx : 0 ~ 127 (p000~p127)         Tone Color Number

(Syntax Example)
  t000 = 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
         00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
         00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
         01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01,
         01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01,
         01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01

This registers the Key Split Table. The "???" of "t???" is a three-digit, single-byte Table Number. The range "000 ~ 031" can be used. These numbers do not have to be consecutive, but the same number may not be used more than once. 

As many tone color numbers (000 ~ 127) as necessary are written after the "t???," separated by commas. Carriage returns can also be used after the commas. 

Return to Top


		

(12)w??? = Sound 3 Waveform Setup

(Syntax)
  w??? = data_array, label

           w??? : w000 ~ w031                              Corresponds to sc3w??? of Tone Color Setup.
  data_array : 32 character hexadecimals          Waveform Data Array
            label : Up to 16 alphanumerics                Label Name

(Syntax Example)
  w000 = 0011235689ACDEEFFFEEDCA986532110, sinewave

Registers the Sound 3 Waveforms. The "???" in "w???" is a three-digit, single-byte number from "000 ~ 031." These numbers do not have to be consecutive, but the same number cannot be used more than once. 

The following content follows the "w??? = " and is separated by commas. 

Return to Top

This 32-character hexadecimal registers the waveform.

            (12) w???

16 single-byte alphanumerics or less. This label name is a Waveform Name  in the Tone Color Setup  described above, and may be used instead of the "sc3w???." (May be omitted.)

            (12) W???


		

(13) mp?? = Music Player Setup

(Syntax)
  mp?? = track

   mp?? : mp00 ~ mp31            Music Player Number
     track : 1 ~ 16                          Number of Tracks

(Syntax Example)
  mp00 = 8
  mp01 = 6

Return to Top

These are two-digit, single-byte Music Player numbers. The values "000 ~ 031" may be used. These numbers do not have to be consecutive, but the same number may not be used more than once. 

            (13) mp??

Indicates the maximum number of tracks that the player in question can play and follows "mp?? = ." 

            (13) mp??


		

(14) x??? = Song Setup

(Syntax)
  s??? = filename, m_player, vgroup, master_vol, priority, reverb, options
             s??? : s000 ~ s999          Song Number
      filename : .MID file                   MIDI File Name
     m_player : 0 ~ 31                     Music Player Used during Performance
          vgroup : 0 ~ 999                 Tone Color Groups Used during Performance
  master_vol : 0 ~ 127                   Master Volume
          priority : 0 ~ 255                  Priorities
           reverb : off, 0 ~ 127           Reverb (No change if off.)
         options : -x                           Doubles the resolution.
                       : -e                          Doesn't shorten the gate time.
                       : -n                          Doesn't compress the sheet music data.

(Syntax Example)
  s000 = m_samp.mid, 0, 0, 100, 0, off, -e

Registers the Song Data.
When beginning a song, the number specified here is used. 

Return to Top

The "???" in "s???" is a single-byte numeral for the song number. Numbers from 000 ~ 1999 can be used. These numbers do not have to be consecutive, but the same number cannot be used more than once. 
The following content is listed after the "s??? = " and is separated using commas. 
All parameters but the "Song File Name" may be omitted. 

            (14) s???

Lists the song data file name. The extension may be omitted if it is .mid. The same file name may not be used more than once. 
Note that as long as this file is 64 characters or less, the relative path (referenced to mid_dir) may be included. 

            (14) s???

0 ~ 31. The music player number used when playing the song data in question. 
(Default Value: 0.)

            (14) s???

0 ~ 999. The Tone Color Group Number used when playing the song data in question. 
(Default Value: 0.)

            (14) s???

0 ~ 127. The overall volume of a song. For example, this might be used when making final adjustments to game sounds in order to preserve the balance of the volume between other songs or sound effects. 
(Default Value: 127.)

            (14) s???

0 ~ 255. The sound production priorities when playing on a music player.
The higher the value, the higher the priority.(Default Value: 0.)

            (14) s???

0 ~ 127 or off.  Direct Sound Reverb value. Once the song in question starts, this level of reverb will be applied to that and all subsequent direct sounds. This does not affect CGB compatible sounds. 
When off, the song will be started without any change to the reverb.  (Default Value: off.)

            (14) s???

This is an option used when converting a .mid File to an .s File. The following functions can be specified.
Separate these elements with spaces. 

-x: Doubles the resolution.(Half notes will be considered whole notes and the tempo will double, so this function doubles the apparent resolution. It is useful on songs that have extremely fast tempos.)

-e: Doesn't shorten the gate time. 

-n: Doesn't compress the song data.

            (14) s???


		

(15) pbymidi = MIDI Input Performance Setup

(Syntax)
  pbymidi = switch, vgroup, master_vol, priority, tempo

           switch : 0 or 1              Normal 0, MIDI input performance 1.
          vgroup : 0 ~ 999           Tone Color Groups for MIDI performance
  master_vol : 0 ~ 127             Master Volume for MIDI performance.
           priority : 0 ~ 255          MIDI performance priorities.
           tempo : 2 ~ 510           MIDI performance Tempo(Affects LFO Speed)

(Syntax Example)
  pbymidi = 0, 0, 120, 200, 120

If an AGB development system that is compatible with Intelligent Systems' MIDI input is used as the simple monitor that goes with this system, it becomes possible to perform MIDI sequencer output real time in AGB. This makes all sorts of settings for those operations. 

Return to Top

0 or 1. When creating normal game sound data use 0, for MIDI input performance use 1. (If omitted 0)

            (15)

0 ~ 999. Tone color group number used with MIDI input performance.  (Default Value: 0.)

            (15)

0 ~ 127. Master volume for the entire track for MIDI Input Performance. (Default Value: 127.)

            (15)

0 ~ 255. Sound production priorities for MIDI input performance. (Default Value: 255.)

            (15)

2 ~ 510. Tempo information cannot be obtained from the MIDI-IN signal, so pseudo-tempo settings are made here. These values affect the LFO speeds (modulation and other features). 
(Default Value: 150.)

            (15)


		

(16) memacc_s = Memory Access Area Size

(Syntax Example)
  memacc_s = 16


In this system, you can access a special RAM area by placing a MEMACC instruction in the song data. Designate the size of this RAM area to be between 0~255.
(Default Value: 16)

This area can be referenced externally from the main program using the array name, m4a_memacc_area[ ].

Return to Top


(17) max_line = Maximum Lines for Processing Time of m4aSoundMain()

(Syntax Example)
  max_line = 80


The processing time for m4aSoundMain( ) in each 1/60 second frame is limited by the approximate number of scan lines. This setting value is the amount of time allowed for processing in lines, and not the location where processing is stopped when scan lines reach it. It is impossible to accurately limit time so in actuality, the setting value is exceeded by a certain number of lines. If 0 is set, this function becomes ineffective.
(*This function cannot be set when using code in system ROM.)

Return to Top






(18) only_dma1 = DMA Limit Switch

(Syntax Example)
  only_dma1 = 0

This system normally uses 2 channels for the AGB DMA function. When a value other than 0 is set here, it will only use one channel. Then the output of the direct sound becomes monaural, but the processing time becomes faster. If a programmer requests, enable this switch.

Return to Top






(19) sys_rom = System ROM Use Switch

(Syntax Example)
  sys_rom = 1


If this is set to a value other than "0", the sound code in system ROM is used, and the code in Game Pak ROM and internal RAM can be minimized with the following restrictions:

- Slower speed than the internal RAM execution version (sys_rom = 0)
- No max_line function
- Must use 2 channels for DMA
-Tone color is slightly different
- Does not operate with development boards prior to TS3

Return to Top


Next:[ Number of Music Player Tracks ]
Back:[ Making Song Data  ]
Top :[ Table of Contents ]